package com.example.equals;

public class CompareEquals {
    public static void main(String[] args) {
        // Run --> Eidt Configurations --> Modify options --> Add VM options 添加一个新启动参数 ：
        // -XX:AutoBoxCacheMax=1024 ， 该参数由Integer.java 源码注释中说明为设置为cache 最大值
        //默认情况下  下列判断为false ， 但设置初始值时，可以为true
        Integer a1 = 1000;
        Integer b1 = 1000;
        System.out.println(a1 == b1);

        //equals1();
    }

    static void equals1(){
        int a = 50;
        Integer a1 = 50;
        Integer b1 = 50;
        Integer c1 = 100;
        Integer d1 = a1 + b1;

        System.out.println(a == a1);
        System.out.println(a == b1);
        System.out.println(a1 == b1);
        System.out.println(c1 == (a1 + b1));
        System.out.println(c1 == d1);
    }

    static void equals2(){
        int a = 100;
        Integer a1 = 100;
        Integer b1 = 100;
        Integer c1 = 200;
        Integer d1 = a1 + b1;

        System.out.println(a == a1);
        System.out.println(a == b1);
        System.out.println(a1 == b1);
        System.out.println(c1 == (a1 + b1));
        System.out.println(c1 == d1);
    }

    static void equals3(){
        int a = 50;
        Integer a1 = 50;
        Integer b1 = 50;
        Integer c1 = 100;
        Integer d1 = a1 + b1;

        System.out.println(a == a1);
        System.out.println(a == b1);
        System.out.println(a1 == b1);
        System.out.println(c1 == (a1 + b1));
        System.out.println(c1 == d1);
    }
}
